package business.database.sqliteMaescorp

import domain.WordOrganismo
import groovy.sql.Sql
import java.util.HashMap;
import java.util.List;

/**
 * DAO para la tabla wordOrganismo
 * @author Administrador
 *
 */
public class WordOrganismoDAO extends AbsWordStatisticDAO<WordOrganismo> {
	
	
	/**
	 * Inicializamos la clase con la instance de SQL
	 * @param sql
	 */
	public WordOrganismoDAO(Sql sql) {
		super(sql,"Organismo");
		
	}
	
	public WordOrganismo select(String word) {
		String sqlQuery = "Select word,${this.centerCOL},per,cnt from Word${this.centerCOL} where word = ?"
		def wrd = sqlite.firstRow(sqlQuery,[word])
					
		if (wrd != null)
			return new WordOrganismo(wrd[0],wrd[1],wrd[2],wrd[3]);
		else return new WordOrganismo(word,"",0,0);
	}
	
	
	
}
